Skip to content

Slice blocked BitPacked without decoding - #10250

Draft
mhk197 wants to merge 4 commits into
developfrom
mk/bitpacked-blocked-slice
Draft

mhk197 wants to merge 4 commits into
developfrom
mk/bitpacked-blocked-slice

Conversation

@mhk197

@mhk197 mhk197 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Tracking Issue: #10167

Summary

Slicing a BitPacked array whose blocks have their own bit widths now runs as a kernel instead of decoding the whole array first. The result stays blocked and holds only the blocks the slice overlaps. Block offsets are relative to the first one, so the kernel reads three boundaries and slices the offsets child and the packed buffer without copying.

Changes

  • SliceKernel slices blocked arrays; SliceReduce still declines them, since it can't read buffers.
  • Release builds don't validate block offsets on construction, so the kernel rejects boundaries outside the packed buffer or off a 128-byte row.
  • Host-resident Primitive offsets are read directly; other encodings go through execute_scalar.

Benchmarks

Local divan benchmark, not committed: slice 1500.. into 128Ki u32 values with block widths cycling 1 to 16 bits, then canonicalize. Apple M5 Max, median.

rows global width 16 blocked, decode first blocked, this PR
1Ki 0.46 µs 10.7 µs 1.0 µs
16Ki 1.46 µs 10.7 µs 1.9 µs
64Ki 5.5 µs 10.6 µs 5.8 µs

The kernel call alone takes 131 ns, against 58 ns for a single width.

Testing

  • compute/slice.rs: ranges within, across and aligned to blocks, to the end, and empty, with primitive and FoR-encoded offsets; kept blocks; nulls and patches; slicing twice; invalid boundaries rejected.

Follow-up: blocked kernels for filter, take, compare/between, is_constant and cast.

@mhk197 mhk197 added the changelog/performance A performance improvement label Oct 2, 2026
@mhk197
mhk197 force-pushed the mk/bitpacked-v2-scheme branch 6 times, most recently from 8da23f9 to 3711acb Compare October 12, 2026 18:30
Signed-off-by: Matt Katz <mhkatz97@gmail.com>
@mhk197
mhk197 force-pushed the mk/bitpacked-blocked-slice branch from ddc804c to 571f608 Compare October 12, 2026 20:10
@mhk197
mhk197 changed the base branch from mk/bitpacked-v2-scheme to develop October 12, 2026 20:10
Signed-off-by: Matt Katz <mhkatz97@gmail.com>
@codspeed

codspeed Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 13.28%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ 1 benchmark measured no execution time

Nothing ran under measurement, usually because the compiler removed the code under test. This result is not comparable, so it counts as unchanged.

Preventing compiler optimizations

⚠️ 14 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

⚡ 3 improved benchmarks
✅ 2210 untouched benchmarks

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ WallTime threshold_avx512[8] 2.1 µs 1.8 µs +15.81%
⚡ WallTime bitpack_blocked_compress_avx2 7.6 µs 6.7 µs +13.41%
⚡ WallTime threshold_avx512[64] 3.2 µs 2.9 µs +10.69%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing mk/bitpacked-blocked-slice (ae93be8) with develop (d42e7c9)

Open in CodSpeed

Signed-off-by: Matt Katz <mhkatz97@gmail.com>
Signed-off-by: Matt Katz <mhkatz97@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/performance A performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant